import "package:ct_pa_majordomo/config/theme_vars.dart";
import "package:flutter/cupertino.dart";
import "package:flutter/material.dart";

class Power extends StatefulWidget {
  const Power({super.key});

  @override
  State<StatefulWidget> createState() => _PowerState();

}

class _PowerState extends State<Power> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        iconTheme: const IconThemeData(color: Colors.white),
        title: const Text("功率阈值设置", style: TextStyle(color: Colors.white),),
        centerTitle: true,
        backgroundColor: ThemeVars.colorPrimary,
        leading: IconButton(
          icon: const Icon(Icons.arrow_back_ios_new),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
      ),
      body: ListView(
        children: <Widget>[
          const Padding(
            padding: EdgeInsets.all(ThemeVars.paddingPage),
            child: Text("提示：设定的功率阈值过低时，会导致电表跳闸，建议设置高于房间内电器的总功率。", style: TextStyle(color: ThemeVars.colorTextSec, fontSize: 13),),
          ),
          const DecoratedBox(
            decoration: BoxDecoration(
              color: Colors.white,
            ),
            child: Padding(
              padding: EdgeInsets.symmetric(horizontal: ThemeVars.paddingPage),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text("功率阈值"),
                  SizedBox(
                    width: 200,
                    child: TextField(
                      textAlign: TextAlign.right,
                      keyboardType: TextInputType.number,
                      decoration: InputDecoration(
                          border: InputBorder.none,
                          hintText: "请输入"
                      ),
                    ),
                  )
                ],
              ),
            ),
          ),
          const SizedBox(height: 5,),
          const Padding(
            padding: EdgeInsets.symmetric(horizontal: ThemeVars.paddingPage),
            child: Text("设定值是：1000-18400范围内", style: TextStyle(color: ThemeVars.colorTextTer, fontSize: 12),),
          ),
          const SizedBox(height: 60,),
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: ThemeVars.paddingPage),
            child: CupertinoButton(
              color: ThemeVars.colorPrimaryDark,
              disabledColor: ThemeVars.colorDisabled,
              onPressed: () {},
              child: const Text("设置"),
            ),
          ),
        ],
      ),
    );
  }
}